<?php

/**
 * GameLearn form base class.
 *
 * @method GameLearn getObject() Returns the current form's model object
 *
 * @package    aiontoolskit
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseGameLearnForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'name'        => new sfWidgetFormInputText(),
      'faction_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GameFaction'), 'add_empty' => false)),
      'class_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GameClass'), 'add_empty' => true)),
      'pc_level'    => new sfWidgetFormInputText(),
      'skill'       => new sfWidgetFormInputText(),
      'skill_level' => new sfWidgetFormInputText(),
      'auto_learn'  => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name'        => new sfValidatorInteger(array('required' => false)),
      'faction_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GameFaction'))),
      'class_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GameClass'), 'required' => false)),
      'pc_level'    => new sfValidatorInteger(),
      'skill'       => new sfValidatorString(array('max_length' => 36)),
      'skill_level' => new sfValidatorInteger(),
      'auto_learn'  => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('game_learn[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'GameLearn';
  }

}
